<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>
<script type="text/javascript">
 $(function(){
	
	 $("#fileDelete").click(function(){
		 if($("#fileUpload").val()==""){
			 alert("등록된 파일이 없습니다.");
		 }else{
			 if(confirm("파일을 삭제하시겠습니까?")){
				 
				 $("#fileUpload").val("");
			 }
		 }
	 });
	 
	 
	 $("#fileDelete1").click(function(){
		 if($("#fileUpload1").val()==""){
			 alert("등록된 파일이 없습니다.");
		 }else{
			 if(confirm("파일을 삭제하시겠습니까?")){
				 
				 $("#fileUpload1").val("");
			 }
		 }
	 });

	 $("#fileDelete2").click(function(){
		 if($("#fileUpload2").val()==""){
			 alert("등록된 파일이 없습니다.");
		 }else{
			 if(confirm("파일을 삭제하시겠습니까?")){
				 
				 $("#fileUpload2").val("");
			 }
		 }
	 });
	 
	 
	 /*
	 $("#fileUpload").change(function(){
		//alert($("#fileUpload").length);  //결과값 무조건 1뜸
		$("#fileUpload1").html("<input type=button name=fileDelete1 id=fileDelete1 value='파일삭제'><input type=file name=file[1]>");
		//$("#menu").html($("#menu").html()+"<p>"+$(this).val()+"</p>");
	 });
	 $("#fileUpload1").on("change",function(){
		 $("#fileUpload2").html("<input type=button name=fileDelete2 id=fileDelete2 value='파일삭제'><input type=file name=file[2]>");
	 }); 
	 
	 */
	 
	//취소버튼 눌렀을때 confirm창이 뜬다.
	$("#cancel").click(function(){
		if(confirm("글작성을 취소하시겠습니까?")){
			location.href="board/contentList.do?nowpage=1"; 
		}
	}) ;
 });
</script>
</head>
<body>

<form action="writeShareBoard.do" method="post"  enctype="multipart/form-data" id="writeF">
	<input type="hidden" name="boardType" value="1">
	<table>
	<tr><td>Title</td><td><input type="text" name="title" ></td></tr>
	</table>
	<table>
	<tr><td>File Attach</td><td><input type="button" name="fileDelete" value="파일삭제" id="fileDelete"></td><td><input type="file" name="files[0]" id="fileUpload"></td></tr>
	<tr><td></td><td><input type="button" name="fileDelete" value="파일삭제" id="fileDelete1"></td><td><input type="file" name="files[1]" id="fileUpload1"></td></tr>
	<tr><td></td><td><input type="button" name="fileDelete" value="파일삭제" id="fileDelete2"></td><td><input type="file" name="files[2]" id="fileUpload2"></td></tr>
	
	</table>
	<!-- <table>
	<tr><td><input type="button" name="fileDelete" value="파일삭제" id="fileDelete"><input type="file" name="file[0]" id="fileUpload"></td></tr>
	<tr><td><span id="fileUpload1"></span></td></tr>
	<tr><td><span id="fileUpload2"></span></td></tr>
	</table> -->
	
	Content <pre><textarea rows="15" cols="40" name="content"></textarea></pre>
	<input type="button" name="cancel" id="cancel" value="취소">
	<input type="submit" value="확인">
</form>
</body>
</html>